﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.Knjizenje"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class KnjizenjeEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ID property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxID;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ID property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDLabel;
		
		/// <summary>
		/// DataTimePicker for the Datum property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxDatum;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Datum property.
		/// </summary>
		protected System.Windows.Forms.Label uxDatumLabel;
		
		/// <summary>
		/// ComboBox for the IDUserCreated property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDUserCreated;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDUserCreated property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDUserCreatedLabel;
		
		/// <summary>
		/// ComboBox for the IDUserModified property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDUserModified;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDUserModified property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDUserModifiedLabel;
		
		/// <summary>
		/// ComboBox for the IDUser property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDUser;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDUser property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDUserLabel;
		
		/// <summary>
		/// DataTimePicker for the DatumCreated property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxDatumCreated;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the DatumCreated property.
		/// </summary>
		protected System.Windows.Forms.Label uxDatumCreatedLabel;
		
		/// <summary>
		/// DataTimePicker for the DatumModified property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxDatumModified;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the DatumModified property.
		/// </summary>
		protected System.Windows.Forms.Label uxDatumModifiedLabel;
		
		/// <summary>
		/// TextBox for the IDStatus property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxIDStatus;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDStatus property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDStatusLabel;
		#endregion
		
		#region Main entity
		private Entities.Knjizenje _Knjizenje;
		/// <summary>
		/// Gets or sets the <see cref="Entities.Knjizenje"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.Knjizenje"/> instance.</value>
		public Entities.Knjizenje Knjizenje
		{
			get {return this._Knjizenje;}
			set
			{
				this._Knjizenje = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxID.DataBindings.Clear();
			this.uxID.DataBindings.Add("Text", this.uxBindingSource, "ID", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDatum.DataBindings.Clear();
			this.uxDatum.DataBindings.Add("Value", this.uxBindingSource, "Datum", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDUserCreated.DataBindings.Clear();
			this.uxIDUserCreated.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDUserCreated", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDUserModified.DataBindings.Clear();
			this.uxIDUserModified.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDUserModified", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDUser.DataBindings.Clear();
			this.uxIDUser.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDUser", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDatumCreated.DataBindings.Clear();
			this.uxDatumCreated.DataBindings.Add("Value", this.uxBindingSource, "DatumCreated", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDatumModified.DataBindings.Clear();
			this.uxDatumModified.DataBindings.Add("Value", this.uxBindingSource, "DatumModified", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDStatus.DataBindings.Clear();
			this.uxIDStatus.DataBindings.Add("Text", this.uxBindingSource, "IDStatus", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="KnjizenjeEditControlBase"/> class.
		/// </summary>
		public KnjizenjeEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_Knjizenje != null) _Knjizenje.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxID = new System.Windows.Forms.TextBox();
			uxIDLabel = new System.Windows.Forms.Label();
			this.uxDatum = new System.Windows.Forms.DateTimePicker();
			uxDatumLabel = new System.Windows.Forms.Label();
			this.uxIDUserCreated = new System.Windows.Forms.ComboBox();
			uxIDUserCreatedLabel = new System.Windows.Forms.Label();
			this.uxIDUserModified = new System.Windows.Forms.ComboBox();
			uxIDUserModifiedLabel = new System.Windows.Forms.Label();
			this.uxIDUser = new System.Windows.Forms.ComboBox();
			uxIDUserLabel = new System.Windows.Forms.Label();
			this.uxDatumCreated = new System.Windows.Forms.DateTimePicker();
			uxDatumCreatedLabel = new System.Windows.Forms.Label();
			this.uxDatumModified = new System.Windows.Forms.DateTimePicker();
			uxDatumModifiedLabel = new System.Windows.Forms.Label();
			this.uxIDStatus = new System.Windows.Forms.TextBox();
			uxIDStatusLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIDLabel
			//
			this.uxIDLabel.Text = "ID:";
			this.uxIDLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIDLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDLabel);			
			//
			// uxID
			//
			this.uxID.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxID);
			this.uxID.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxID);
			//
			// uxDatumLabel
			//
			this.uxDatumLabel.Text = "Datum:";
			this.uxDatumLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxDatumLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDatumLabel);			
			//
			// uxDatum
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxDatum);
			this.uxDatum.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxDatum);
			//
			// uxIDUserCreatedLabel
			//
			this.uxIDUserCreatedLabel.Text = "IDUserCreated:";
			this.uxIDUserCreatedLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxIDUserCreatedLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDUserCreatedLabel);			
			//
			// uxIDUserCreated
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDUserCreated);
			this.uxIDUserCreated.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxIDUserCreated);
			//
			// uxIDUserModifiedLabel
			//
			this.uxIDUserModifiedLabel.Text = "IDUserModified:";
			this.uxIDUserModifiedLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxIDUserModifiedLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDUserModifiedLabel);			
			//
			// uxIDUserModified
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDUserModified);
			this.uxIDUserModified.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxIDUserModified);
			//
			// uxIDUserLabel
			//
			this.uxIDUserLabel.Text = "IDUser:";
			this.uxIDUserLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxIDUserLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDUserLabel);			
			//
			// uxIDUser
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDUser);
			this.uxIDUser.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxIDUser);
			//
			// uxDatumCreatedLabel
			//
			this.uxDatumCreatedLabel.Text = "DatumCreated:";
			this.uxDatumCreatedLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxDatumCreatedLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDatumCreatedLabel);			
			//
			// uxDatumCreated
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxDatumCreated);
			this.uxDatumCreated.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxDatumCreated);
			//
			// uxDatumModifiedLabel
			//
			this.uxDatumModifiedLabel.Text = "DatumModified:";
			this.uxDatumModifiedLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxDatumModifiedLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDatumModifiedLabel);			
			//
			// uxDatumModified
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxDatumModified);
			this.uxDatumModified.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxDatumModified);
			//
			// uxIDStatusLabel
			//
			this.uxIDStatusLabel.Text = "IDStatus:";
			this.uxIDStatusLabel.Location = new System.Drawing.Point(3, 182);
			this.Controls.Add(this.uxIDStatusLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDStatusLabel);			
			//
			// uxIDStatus
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDStatus);
			this.uxIDStatus.Location = new System.Drawing.Point(160, 182);
			this.Controls.Add(this.uxIDStatus);
			//
			// uxIDUserCreated
			//				
			this.uxIDUserCreated.DisplayMember = "Naziv";	
			this.uxIDUserCreated.ValueMember = "ID";	
			//
			// uxIDUserModified
			//				
			this.uxIDUserModified.DisplayMember = "Naziv";	
			this.uxIDUserModified.ValueMember = "ID";	
			//
			// uxIDUser
			//				
			this.uxIDUser.DisplayMember = "Naziv";	
			this.uxIDUser.ValueMember = "ID";	
			// 
			// KnjizenjeEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "KnjizenjeEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.Djelatnik> _IDUserCreatedList;
		
		/// <summary>
		/// The ComboBox associated with the IDUserCreated property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Djelatnik> IDUserCreatedList
		{
			get {return _IDUserCreatedList;}
			set 
			{
				this._IDUserCreatedList = value;
				this.uxIDUserCreated.DataSource = null;
				this.uxIDUserCreated.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDUserCreatedList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDUserCreated property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDUserCreatedList
		{
			get { return _allowNewItemInIDUserCreatedList;}
			set
			{
				this._allowNewItemInIDUserCreatedList = value;
				this.uxIDUserCreated.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.Djelatnik> _IDUserModifiedList;
		
		/// <summary>
		/// The ComboBox associated with the IDUserModified property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Djelatnik> IDUserModifiedList
		{
			get {return _IDUserModifiedList;}
			set 
			{
				this._IDUserModifiedList = value;
				this.uxIDUserModified.DataSource = null;
				this.uxIDUserModified.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDUserModifiedList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDUserModified property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDUserModifiedList
		{
			get { return _allowNewItemInIDUserModifiedList;}
			set
			{
				this._allowNewItemInIDUserModifiedList = value;
				this.uxIDUserModified.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.Djelatnik> _IDUserList;
		
		/// <summary>
		/// The ComboBox associated with the IDUser property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Djelatnik> IDUserList
		{
			get {return _IDUserList;}
			set 
			{
				this._IDUserList = value;
				this.uxIDUser.DataSource = null;
				this.uxIDUser.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDUserList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDUser property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDUserList
		{
			get { return _allowNewItemInIDUserList;}
			set
			{
				this._allowNewItemInIDUserList = value;
				this.uxIDUser.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
